﻿Partial Public Class Home
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Util.EhVazioNull(Session("IdUsuario")) Then
            Response.Redirect("Login.aspx")
        End If
        VerificaUsuarioAdmin()
    End Sub

    Protected Sub VerificaUsuarioAdmin()
        Dim ta As DataSet1TableAdapters.UsuarioTableAdapter = New DataSet1TableAdapters.UsuarioTableAdapter
        Dim table As DataSet1.UsuarioDataTable
        table = ta.GetDataByIdUsuario(Session("IdUsuario"))
        If table.Rows(0).Item("Login") <> "admin" Then
            lnkNovoUsuario.Visible = False
        End If
    End Sub

    Protected Sub LinkButton1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles LinkButton1.Click
        Session("IdUsuario") = Nothing
        Response.Redirect("Login.aspx")
    End Sub
End Class